#ifndef REGISTERDIALOG_H
#define REGISTERDIALOG_H

#include <QDialog>
#include <QObject>
#include <QWidget>

#include "global.h"


class QStackedWidget;
class QLineEdit;
class QLabel;

class RegisterDialog : public QDialog
{
    Q_OBJECT
public:
    explicit RegisterDialog(QWidget *parent = nullptr);

private:
    void setupUi(void);
    QWidget * createRegisterPage(void);
    void initHttpHandlers(void);

    void showTip(const QString &tip, bool isOk);

private slots:
    void slot_reg_mod_finished(ReqId req_id, const QString & res, ErrorCodes err);

private:
    QLabel * m_errTipLabel = nullptr;
    QStackedWidget *m_stackedWidget = nullptr;

    QLineEdit * userRegLineEdit = nullptr;          // 用户名
    QLineEdit * pwdRegLineEdit = nullptr;           // 密码
    QLineEdit * pwdConfirmRegLineEdit = nullptr;    // 确认密码
    QLineEdit * emailRegLineEdit = nullptr;         // 邮箱
    QLineEdit * varifyRegLineEdit = nullptr;        // 验证码

    QMap<ReqId, std::function<void(const QJsonObject &)>> m_httpHandlers;
};

#endif // !REGISTERDIALOG_H
